package com.example.controller;

import com.example.dto.AccountDto;
import com.example.service.AccountService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/api/v1/account")
public class AccountController {

    @Autowired
    private AccountService accountService;

    /**
     * 用户登录功能：
     * 请求路径：/api/v1/account/checkWalltById
     * 请求方式：get
     * 请求参数：(手机号码和密码)
     * 响应结果：用户钱包余额
     */
    @GetMapping("/checkWalltById")
    public Double checkWalltById(@RequestBody AccountDto accountDto){
        //表现层接收参数转调业务层
        Double money = accountService.checkWalltById(accountDto.getId(),accountDto.getPassword());
        return money;
    }
}
